import speech_recognition as sr

audio_file = "/Users/lzy/Downloads/demo.wav"

r = sr.Recognizer()
with sr.AudioFile(audio_file) as source:
    audio = r.record(source)

# 语音转文本
print(r.recognize_sphinx(audio, language='zh-CN'))